package com.xsmart.order.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.common.entity.ResponseBean;
import com.xsmart.order.services.AdConfigruationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author DIYC
 */
@Controller
@RequestMapping("/api")
public class AdConfigruationController {
    @Autowired
    AdConfigruationService adConfigruationService;

    /**
     * 查询
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/AdConfigruationService/queryAdConfigruation", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean queryAdConfigruation(@ModelAttribute RequestBean requestBean, HttpServletRequest request){
        return adConfigruationService.queryAdConfigruation(requestBean);
    }

    /**
     * 新增
     *
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/AdConfigruationService/addAdConfigruation")
    @ResponseBody
    public ResponseBean addAdConfigruation(@ModelAttribute RequestBean requestBean, HttpServletRequest request){
        return adConfigruationService.addAdConfigruation(requestBean);
    }

    /**
     * 改
     *
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/AdConfigruationService/modAdConfigruation", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean modAdConfigruation(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adConfigruationService.modAdConfigruation(requestBean);
    }

    /**
     * 删
     *
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/AdConfigruationService/delAdConfigruation", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean delAdConfigruation(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adConfigruationService.delAdConfigruation(requestBean);
    }

    /**
     * 查询全部的广告配置列表
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/AdConfigruationService/queryAllAdConfigruation", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean queryAllAdConfigruation(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return adConfigruationService.queryAllAdConfigruation(requestBean);
    }

}
